#include <bits/stdc++.h>

using namespace std;

const int maxn = 110;
char mp[maxn][maxn];
int n,d;
bool ans[maxn][maxn];
string s = "yizhong";
int xx[] = {1,-1,0,0,-1,-1,1,1};
int yy[] = {0,0,1,-1,-1,1,-1,1};
queue <int> tx;
queue <int> ty;
void dfs(int x,int y,int f){
    if(f >= 6){
        while(!tx.empty()){
            ans[tx.front()][ty.front()]=1;
            tx.pop();
            ty.pop();
        }
        return;
    }
//    for(int i=0;i<8;i++){
       int dx = xx[d]+x;
       int dy = yy[d]+y;
       if(dx<=n&&dx>=1&dy<=n&&dy>=1&&mp[dx][dy]==s[f+1]){
        tx.push(dx);
        ty.push(dy);
        dfs(dx,dy,f+1);
       }
//    }
    return;
}
queue <int>sx;
queue <int>sy;
int main()
{
    cin>>n;
    for(int i = 1 ;i<=n;i++){
        for(int j=1;j<=n;j++){
            cin>>mp[i][j];
            if(mp[i][j]=='y')
            {
                sx.push(i);
                sy.push(j);
            }
        }
    }
    while(!sx.empty()){
        for(int i=0;i<8;i++){
           int dx = xx[i]+sx.front();
           int dy = yy[i]+sy.front();
           if(dx<=n&&dx>=1&dy<=n&&dy>=1&&mp[dx][dy]==s[1]){
                tx.push(sx.front());
                ty.push(sy.front());
                tx.push(dx);
                ty.push(dy);
                d = i;
                dfs(dx,dy,1);
                while(!tx.empty()){
                    tx.pop();
                    ty.pop();
                }
            }
        }

        sx.pop();
        sy.pop();
    }
    for(int i = 1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(ans[i][j]==1)cout<<mp[i][j];
            else cout<<'*';
        }
        cout<<endl;
    }
    return 0;
}
